package request

import (
	"mallgo/internal/common/request"
	"mallgo/internal/resources/product/model"
)

type ProductRequest struct {
	ID       int64   `json:"id"`
	Name     string  `json:"name"`
	Note     string  `json:"note"`
	Logo     string  `json:"logo"`
	Price    float64 `json:"price"`
	Discount float64 `json:"discount"`
}

type ProductSearch struct {
	request.PageRequest
	Name string `json:"name"`
	Note string `json:"note"`
}

func ConvertModel(request *ProductRequest) *model.Product {
	return &model.Product{
		ID:       request.ID,
		Name:     &request.Name,
		Note:     &request.Note,
		Logo:     &request.Logo,
		Price:    &request.Price,
		Discount: &request.Discount,
	}
}
